Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(crosschain): zeta withdraw fees #991

Merged
merged 28 commits into from
Aug 29, 2023
Merged

fix(crosschain): zeta withdraw fees #991

merged 28 commits into from
Aug 29, 2023

Conversation

lumtis
Copy link
Member

@lumtis lumtis commented Aug 17, 2023

Description

This PR adds the payment of gas fees when sending assets from ZetaChain to an external chain.

Before

orchestrator  | =======================================
orchestrator  | Step 4: Sending ZETA from ZEVM to Ethereum
orchestrator  | =======================================
orchestrator  | zevm chainid: 101
orchestrator  | Deposit tx hash: 0x57560e7ace43cde61935fe451a407bbbf9669349ef931e5fedccb845385b7337
orchestrator  | Deposit tx receipt: status 1
orchestrator  | wzeta.approve tx hash: 0x227aa1bf146eb335681da0f0516578b5b76d0598d27a28617f08adb658e508e1
orchestrator  | approve tx receipt: status 1
orchestrator  | send tx hash: 0x32999ff40b21204ceeea980ebbc2e83bc8e3098e8a564644325fea8508a1151d
orchestrator  | send tx receipt: status 1
orchestrator  |   Logs:
orchestrator  |     Dest Addr: 0xE5C5367B8224807Ac2207d350E60e1b6F27a7ecC
orchestrator  |     Dest Chain: 1337
orchestrator  |     Dest Gas: 250000
orchestrator  |     Zeta Value: 100000000000000000
orchestrator  | waiting for cctx status to change to final...
orchestrator  | Waiting for cctx to be mined by inTxHash: 0x32999ff40b21204ceeea980ebbc2e83bc8e3098e8a564644325fea8508a1151d
orchestrator  | Deposit receipt cctx index: [0x66daa9be9e7734152a31766bda229f94aae5bd4384f0450ead7a6941db21eba9]
orchestrator  | Deposit receipt cctx status: OutboundMined; The cctx is processed
orchestrator  |     Dest Addr: 0xE5C5367B8224807Ac2207d350E60e1b6F27a7ecC
orchestrator  |     sender addr: 239e96c8f17c85c30100ac26f635ea15f23e9c67
orchestrator  |     Zeta Value: 100000000000000000
orchestrator  | test finishes in 33.046856141s
orchestrator  | ETH: TSS balance (1100951919000000000) >= ZRC20 TotalSupply (1100000000000000000)
orchestrator  | BTC: Balance (126000000) >= ZRC20 TotalSupply (125000000)
orchestrator  | USDT: TSS balance (0) >= ZRC20 TotalSupply (0)
orchestrator  | ZETA: TSS balance (99900000000000000000) < ZRC20 TotalSupply (8402100100000000000000000)

After

orchestrator  | =======================================
orchestrator  | Step 4: Sending ZETA from ZEVM to Ethereum
orchestrator  | =======================================
orchestrator  | zevm chainid: 101
orchestrator  | Deposit tx hash: 0x79df1ac5c7ef729947ccfb50814d24c486888fccab57a126afc52b841dc846e9
orchestrator  | Deposit tx receipt: status 1
orchestrator  | wzeta.approve tx hash: 0x3e3eaf2b3f2ec5308be36d9e04aeabeed15159b3bc31b9c375b9a654a0a188c9
orchestrator  | approve tx receipt: status 1
orchestrator  | send tx hash: 0x0c141677ffb8644a2cec222edabeb3a4cb0b8d5344e1e2dbed255ec6d4a4fec4
orchestrator  | send tx receipt: status 1
orchestrator  |   Logs:
orchestrator  |     Dest Addr: 0xE5C5367B8224807Ac2207d350E60e1b6F27a7ecC
orchestrator  |     Dest Chain: 1337
orchestrator  |     Dest Gas: 250000
orchestrator  |     Zeta Value: 10000000000000000000
orchestrator  | waiting for cctx status to change to final...
orchestrator  | Waiting for cctx to be mined by inTxHash: 0x0c141677ffb8644a2cec222edabeb3a4cb0b8d5344e1e2dbed255ec6d4a4fec4
orchestrator  | Deposit receipt cctx index: [0xfe936294fb317d3b67562984bd33d857b1c90cb7ae590e3b6517da75c6ac54b4]
orchestrator  | Deposit receipt cctx status: OutboundMined; The cctx is processed
orchestrator  |     Dest Addr: 0xE5C5367B8224807Ac2207d350E60e1b6F27a7ecC
orchestrator  |     sender addr: 239e96c8f17c85c30100ac26f635ea15f23e9c67
orchestrator  |     Zeta Value: 7999999999997472361
orchestrator  | test finishes in 33.121841558s
orchestrator  | ETH: TSS balance (1101883949000000000) >= ZRC20 TotalSupply (1100999999997479944)
orchestrator  | BTC: Balance (126000000) >= ZRC20 TotalSupply (125000000)
orchestrator  | USDT: TSS balance (999999900) >= ZRC20 TotalSupply (999999900)
orchestrator  | ZETA: TSS balance (92000000000002527639) < ZRC20 TotalSupply (8402092200000000002527639)

Changes

  • Add gas payment in Zeta withdraw fees when withdrawing zetas
  • Add some more logs in smoke tests
  • Fix Zetaclient from using the incorrect amount for withdrawal events
  • Add options to call EVM without sending events

Note

There are issues when emitting Ethereum events in the process tx hook. This bug is documented here: #1010

In this PR we skip emitting the Ethereum event when calling the smart contract methods for paying gas: (swap zeta->zrc20, zrc20 burn)

Closes: #980

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Include instructions and any relevant details so others can reproduce.

  • Tested CCTX in localnet
  • Tested in development environment
  • Go unit tests
  • Go integration tests
  • Tested via GitHub Actions

Checklist:

  • I have added unit tests that prove my fix feature works

@lumtis lumtis self-assigned this Aug 17, 2023
@lumtis lumtis changed the title Fix/zeta withdraw fees fix(crosschain): zeta withdraw fees Aug 17, 2023
@lumtis lumtis marked this pull request as ready for review August 22, 2023 17:25
@lumtis lumtis requested a review from ws4charlie August 24, 2023 17:26
Copy link
Contributor

@ws4charlie ws4charlie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Left a minor comment

Copy link
Contributor

@kevinssgh kevinssgh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Good, just one comment

@lumtis lumtis merged commit 4173f36 into develop Aug 29, 2023
16 checks passed
@lumtis lumtis deleted the fix/zeta-withdraw-fees branch August 29, 2023 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants